﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BaseArtList.aspx.cs" Inherits="Com.CMS263.Web.manage.SubBaseArt.BaseArtList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <link href="../style/main.css" rel="stylesheet" type="text/css" />
    <link href="../common/validator.css" rel="stylesheet" type="text/css" />

    <script language="javascript" src="/js/jquery-1.4.2.min.js"></script>

    <script language="javascript" type="text/javascript">
        var npage = 0;
        function checkPageNum(obj, obj2) {
            var num = $("#pagetext").val();
            var p = /^[1-9]\d*$/;

            if (num.length < 1) {
                alert("请输入要跳转的页码");

            }
            else if (!p.exec(num)) {
                $("#pagetext").attr("value", 1);
                alert("要跳转的页码请输入正整数");
            }
            else if (num > obj) {
                $("#pagetext").attr("value", obj);
                npage = obj;

            }
            else if (num < 1) {
                $("#pagetext").attr("value", 1);
                npage = 1;

            }
            else {

            }

        }
        function pageUrl(obj) {

            window.location.href = '?page=' + $("#pagetext").val() + "&type=" + obj;
        }
    </script>

    <script language="javascript">
        function del(id, obj) {
            if (confirm('这是一个不可逆的操作，真的要删除此条记录')) {
                $.post("action.aspx", { id: id }, function(data) {
                    if (data == "ok") {
                        alert('删除成功');
                        $(obj.parentNode.parentNode).remove();
                    }
                })
            }
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_1">
            <tr>
                <td height="23" class="table_2">
                    <asp:Label ID="lbTypeName" runat="server"></asp:Label>
                    管理
                </td>
            </tr>
            <tr>
                <td class="tdside" align="left">
                    <a href="AddBaseArt.aspx?pid=<%=Request["pid"] %>&artid=<%=Request["artid"] %>">添加新内容</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    搜索:<asp:TextBox ID="txtKey" runat="server"></asp:TextBox>
                    <asp:Button ID="Button1" runat="server" Text="搜索" OnClick="Button1_Click" />
                    <br />
                </td>
            </tr>
            <tr>
                <td>
                    <table width="100%">
                        <tr style="text-align: center">
                            <td>
                                排序编号
                            </td>
                            <td>
                                id
                            </td>
                            <td>
                                标题
                            </td>
                            <%foreach (Com.CMS263.PO.ExtAttribute attr in eaList)
                              { %>
                            <td>
                                <%=attr.attrTxtName %>
                            </td>
                            <%} %><td>
                                状态
                            </td>
                            <td>
                                操作
                            </td>
                        </tr>
                        <% foreach (Com.CMS263.PO.ArtBase art in artList)
                           { %>
                        <tr style="background-color: #d7f2fd; text-align: center">
                            <td>
                                <%=art.orderNum %>
                            </td>
                            <td>
                                <%=art.id %>
                            </td>
                            <td>
                                <a title="<%=art.title %>">
                                    <%=Com.CMS263.Util.StringUtil.GetText(Com.CMS263.Util.StringUtil.CleanAll(art.title),15) %></a>
                            </td>
                            <%
                                foreach (Com.CMS263.PO.ExtAttribute attr in eaList)
                                {
                            %>
                            <td>
                                <%if (attr.attrType == 4)
                                  {
                                      if (this.GetExtValueByBaseArtId(art.id, attr.id) != "")
                                      {
                                          Response.Write("<img src='/ArtUpFile/" + this.GetExtValueByBaseArtId(art.id, attr.id) + "' width='100' height='100'/>");
                                      }
                                      else
                                      {
                                          Response.Write("<img src='/ArtUpFile/zwtp.jpg' width='100' height='100'/>");
                                      }
                                  }
                                  else if (attr.attrType == 2)
                                  {
                                      Response.Write("<a title='" + this.GetExtValueByBaseArtId(art.id, attr.id).Replace("'", "’") + "'>" + Com.CMS263.Util.StringUtil.GetText(this.GetExtValueByBaseArtId(art.id, attr.id).Replace("'", "’"), 20) + "</a>");

                                  }
                                  else if (attr.attrType == 9) {
                                      Response.Write("<a href='"+attr.defaultValue+"&artid="+art.id+"'>" + attr.attrTxtName + "</a>");
                                  }
                                  else
                                  {
                                      Response.Write("<a title='" + this.GetExtValueByBaseArtId(art.id, attr.id).Replace("'", "’") + "'>" + Com.CMS263.Util.StringUtil.GetText(this.GetExtValueByBaseArtId(art.id, attr.id).Replace("'", "’"), 20) + "</a>");
                                  }
                                %>
                            </td>
                            <%} %>
                            <td>
                                <%=art.isBest==0?"正常":"<span style='color:red'>推荐</span>" %>
                            </td>
                            <td>
                                <a href="ModArt.aspx?pid=<%=Request["pid"] %>&id=<%=art.id %>&page=<%=Request["page"] %>&artid=<%=Request["artid"] %>">
                                    修改</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a style="cursor: pointer" onclick="del(<%=art.id %>,this)">
                                        删除</a>
                            </td>
                        </tr>
                        <%} %>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="tdside" align="right">
                    <%=GetPager() %>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
